program exemplo6pg90(input,output);
	var a:integer;

	function f( m: integer; n:integer; function h:integer; var x:integer):integer;
	  var s,i:integer;
	begin
	 	i:=m; 
	 	s:=0;
	 	while i<=n
	 		do begin 
	 			s:=s+h(i);
	 			i:=i+1;
	 			a:=a+1
	 		   end;
	 	f:=s;
	 	x:=a;
	end;
	procedure g;
		var a,b:integer;
		function k1(x:integer):integer;
		begin 
			k1:=x*x
		end;
		function k2(x:integer):integer;
		begin 
			k2:=k1(k1(x))
		end;
	begin
		write( f(1,3,k1,a), a );
		write( f(1,2,k2,b), b );
	end;
begin
	a:=0;
	g
end.
		

           
